<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
  <script>
    var  arr=[1,2,3,4,2,5,6,2,7,2];
    var  index=0,newarr = [];
    for(var i in arr){
      if(arr[i]!==2){
        newarr[index] = arr[i];
        ++index;
      }
    }
  </script>
</head>
<body>

</body>
</html>
